//
//  PKRadioMainListTableViewCell.m
//  PianKe
//
//  Created by ybq on 15/12/23.
//  Copyright © 2015年 B7_Young. All rights reserved.
//

#import "PKRadioMainListTableViewCell.h"

@implementation PKRadioMainListTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _mainImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 70, 70)];
        _NewImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 28, 28)];
        _NewImageView.image = [UIImage imageNamed:@"new"];
        [_mainImageView addSubview:_NewImageView];
        [self.contentView addSubview:_mainImageView];
        
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(90, 15, 100, 20)];
        _titleLabel.font = [UIFont systemFontOfSize:14];
        [self.contentView addSubview:_titleLabel];
        
        _unameLabel = [[UILabel alloc] initWithFrame:CGRectMake(90, 40, 60, 15)];
        _unameLabel.font = [UIFont systemFontOfSize:10];
        _unameLabel.textColor = [UIColor colorWithRed:160.0 / 255 green:170.0 / 255 blue:190.0 / 255 alpha:1];
        [self.contentView addSubview:_unameLabel];
        
        _descLabel = [[UILabel alloc] initWithFrame:CGRectMake(90, 65, 280, 10)];
        _descLabel.font = [UIFont systemFontOfSize:10];
        _descLabel.textColor = [UIColor lightGrayColor];
        [self.contentView addSubview:_descLabel];
        
        _countLabel = [[UILabel alloc] initWithFrame:CGRectMake(315, 20, 50, 15)];
        _countLabel.font = [UIFont systemFontOfSize:9];
        _countLabel.textColor = [UIColor lightGrayColor];
        _countLabel.textAlignment = NSTextAlignmentRight;
        [self.contentView addSubview:_countLabel];
    }
    return self;
}

- (void)setModel:(PKRadioMainModel *)model {
    _model = model;
    _titleLabel.text = model.title;
    _countLabel.text = [NSString stringWithFormat:@"%@",model.count];
    _unameLabel.text = [NSString stringWithFormat:@"by:%@",model.uname];
    _descLabel.text = model.desc;
    [_mainImageView sd_setImageWithURL:[NSURL URLWithString:model.coverimg] placeholderImage:[UIImage imageNamed:@"guangpan"]];
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
